/**
 * 检查部门
 * @param oForm
 * @returns {boolean}
 */
function checkDepartment(oForm) {
    var name = str_trim($(oForm).find('#name').val());
    if (name == '') {
        layerMsg('部门名称不能为空!', 2);
        $(oForm).find('#name').focus();
        $(oForm).find('#name').val(name);
        return false;
    }
    var contacts = str_trim($(oForm).find('#contacts').val());
    if (contacts == '') {
        layerMsg('联系人不能为空!', 2);
        $(oForm).find('#contacts').focus();
        $(oForm).find('#contacts').val(contacts);
        return false;
    }

    var mobile = str_trim($(oForm).find('#mobile').val());
    var phone = str_trim($(oForm).find('#phone').val());
    if( mobile == '' && phone == '' ){
        layerMsg('手机号码和电话号码必须填写一个!',2);
        $(oForm).find('#mobile').focus();
        $(oForm).find('#mobile').val(mobile);
        return false;
    }
    if(phone != ''){
        var regu =/(^[0-9]{2,5}\-[0-9]{7,9})((\-\d{0,10})?)$/g;
        if(!regu.test(phone)){
            layerMsg('请输入正确的电话号码!',2);
            $(oForm).find('#phone').focus();
            $(oForm).find('#phone').val(phone);
            return false;
        }
    }

    var fax = str_trim($(oForm).find('#fax').val());
    if( fax != ''){
        var regu =/(^[0-9]{2,5}\-[0-9]{7,9})$/g;
        if(!regu.test(fax)){
            layerMsg('请输入正确的传真号码!',2);
            $(oForm).find('#fax').focus();
            $(oForm).find('#fax').val(fax);
            return false;
        }
    }
    var email = str_trim($(oForm).find('#email').val());
    if(email!= ''){
        var regu =/^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/;
        if (!regu.test(email)){
            layerMsg('请输入正确的邮箱地址!',2);
            $(oForm).find('#email').focus();
            $(oForm).find('#email').val(email);
            return false;
        }
    }
    $(oForm).find("input[type='submit']").val('保存中...');
    $(oForm).find("input[type='submit']").attr('disabled', true);
    return true;
}
